1. Technology Field
The present invention relates to a data writing method for a rewritable non-volatile memory module, and a memory controller and a memory storage apparatus using the same.
2. Description of Related Art
Along with the widespread of digital cameras, cell phones, and MP3 in recently years, the consumers' demand to storage media has increased drastically. Rewritable non-volatile memory is one of the most adaptable storage media to portable electronic products (for example, notebook computers) due to its many characteristics such as data non-volatility, low power consumption, small volume, non-mechanical structure, and fast access speed. A solid state drive (SSD) is a storage apparatus which uses a flash memory as its storage medium. Thus, in recent years, the flash memory industry has become a major part of the electronic industry.
Because error bits may occur in data stored in a flash memory due to various factors (for example, electric leakage of memory cells, program failure, and damage, etc), an error checking and correcting (ECC) circuit is usually configured in a memory storage system and an ECC code is generated for the data stored in the flash memory, so as to ensure the accuracy of the data.
Taking a flash memory storage apparatus as an example, when a computer host connected to the flash memory storage apparatus transmits data to be written to the flash memory storage apparatus, the ECC circuit in the flash memory storage apparatus generates a ECC code for the data and a control circuit in the flash memory storage apparatus writes the data and the ECC code into the flash memory of the flash memory storage apparatus. Subsequently, when the computer host is about to read data from the flash memory storage apparatus, the control circuit reads the data and the corresponding ECC code from the flash memory and the ECC circuit performs an ECC procedure according to the data and the corresponding ECC code to ensure the accuracy of the data.
FIG. 1 is a diagram illustrating the data structure of data written into and read from a flash memory storage apparatus.
Referring to FIG. 1, during the writing process, an original data OD and an ECC code EC corresponding to the original data OD are written into the flash memory storage apparatus. Subsequently, when the original data OD is read from the flash memory storage apparatus, the ECC code EC is also read to perform an ECC procedure on the original data OD. If the data is accurate, the control circuit transmits the data to the computer host, and if there are error bits EB in the data, the ECC procedure performed by the ECC circuit tries to correct these error bits EB. Herein if the number of the error bits EB is smaller than the number of error bits that can be corrected by the ECC circuit, the error bits EB are corrected and the control circuit transmits the corrected data to the computer host. Contrarily, if the number of the error bits EB exceeds the number of error bits that can be corrected by the ECC circuit, the control circuit notifies the computer host that the data is lost.
Thereby, how to ensure the accuracy of data has become one of the major subjects in the industry.
Nothing herein should be construed as an admission of knowledge in the prior art of any portion of the present invention. Furthermore, citation or identification of any document in this application is not an admission that such document is available as prior art to the present invention, or that any reference forms a part of the common general knowledge in the art.